package com.xuetang9.t9.xinhuaxia.service.impl;

import com.xuetang9.t9.xinhuaxia.beans.SocialPublish;
import com.xuetang9.t9.xinhuaxia.mappers.SocialPublishMapper;
import com.xuetang9.t9.xinhuaxia.service.ISocialPublishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 陈焱
 * @version 1.0
 * @desc
 * @time 2020/2/26 下午 5:25
 * @copyright liyq
 * @address 成都西部国际金融中心2栋2201
 **/
@Service
public class SocialPublishService implements ISocialPublishService {

    @Autowired
    private SocialPublishMapper socialPublishMapper;

    @Override
    public List<SocialPublish> queryAll() {
        return socialPublishMapper.selectAll();
    }

    @Override
    public boolean add(SocialPublish socialPublish) {
        return socialPublishMapper.insert(socialPublish)>0;
    }

    @Override
    public int getSocialPublishMaxCountId() {
        return socialPublishMapper.getSocialPublishMaxCountId();
    }

    @Override
    public List<SocialPublish> queryAllByUser(Integer usserid) {
        return socialPublishMapper.queryAllByUserid(usserid);
    }

    @Override
    public SocialPublish querybypid(SocialPublish socialPublish) {
        return socialPublishMapper.selectOne(socialPublish);
    }

    @Override
    public boolean addlike(Integer pid) {
        return socialPublishMapper.modifyLike(pid)>0;
    }
}
